// Do not remove the include below
//#include "Server.h"
#include "EchoServer.h"
#include "SerialConnector.h"
#include "Logger.h"

static EchoServer g_server;
static Connection::ID g_connectionID;
static SerialConnector g_serialConnector;

//The setup function is called once at startup of the sketch
void setup()
{
	Logger::addStream( &Serial);

	g_connectionID = g_server.Connect(g_serialConnector);

	Logger::log("[setup() - exit]\n\r");
}

// The loop function is called in an endless loop
void loop()
{
	Logger::log("[loop() - enter]\n\r");

	if (g_server.Serve(g_connectionID) == IServer::SUCCESS)
	{
		Logger::log("[loop() - Serve was successful]\n\r");
	}
	else
	{
		Logger::log("[loop() - Serve failed]\n\r");
	}

	Logger::log("[loop() - exit]\n\r\n\r");

	delay(5000);
}
